       IDENTIFICATION DIVISION.
       PROGRAM-ID. DEPOSI.

       ENVIRONMENT DIVISION.
       CONFIGURATION SECTION.
           SPECIAL-NAMES.
               DECIMAL-POINT IS COMMA.

       INPUT-OUTPUT SECTION.
        FILE-CONTROL.
           SELECT OPTIONAL FD-CLIENTES ASSIGN TO "CLIENTES.DAT"
               ORGANIZATION IS INDEXED
               ACCESS MODE IS DYNAMIC
               RECORD KEY IS FD-CONTA
               FILE STATUS IS WS-FD-CLIENTES-STATUS.

       DATA DIVISION.
       FILE SECTION.
       FD FD-CLIENTES.

       01 FD-CLIENTES-REG.
            02 FD-CONTA           PIC 9(006).
            02 FD-CPF             PIC 9(011).
            02 FD-NOME            PIC X(060).
            02 FD-DATA-NASC.
                03 ANO-NASC    PIC 9999.
                03 MES-NASC    PIC 99.
                03 DIA-NASC    PIC 99.
            02 FD-SALDO        PIC 9(8).
			02 FD-DATA-ABERTURA.
                03 ANO-CONTA   PIC 9999.
                03 MES-CONTA   PIC 99.
                03 DIA-CONTA   PIC 99.

       WORKING-STORAGE SECTION.
       01 WS-FD-CLIENTES-STATUS PIC X(2).
       01 ED-SALDO PIC ZZZZ9999.
       01 ED-VALOR PIC ZZZZ9999.
       01 WS-VALOR PIC 9(8) VALUE ZEROES.
       01 WS-OPCAO PIC X(01) VALUE SPACES.
           88 FINALIZA VALUE "n", "N".

       PROCEDURE DIVISION.
           PERFORM 001-INICIO.
           PERFORM 002-PROCESSA UNTIL FINALIZA.
           PERFORM 003-FIM.

       001-INICIO.
           OPEN I-O FD-CLIENTES.

       002-PROCESSA.
           DISPLAY "DIGITE A CONTA PARA REALIZAR O DEPOSITO: " AT 0405.
           ACCEPT FD-CONTA AT 0505 WITH PROMPT.
		   
           READ FD-CLIENTES.

           IF WS-FD-CLIENTES-STATUS EQUALS "23"
               DISPLAY "ARQUIVO NAO EXISTENTE"
           ELSE
               DISPLAY "ERRO" WS-FD-CLIENTES-STATUS
           END-IF.

           DISPLAY "DIGITE O VALOR A SER DEPOSITADO: " AT 0705.
           ACCEPT ED-VALOR AT 0805 WITH PROMPT.

           MOVE ED-VALOR TO WS-VALOR.

           COMPUTE FD-SALDO = FD-SALDO + WS-VALOR.

           REWRITE FD-CLIENTES-REG.
 
           IF WS-FD-CLIENTES-STATUS EQUALS "00"
             DISPLAY "DEPOSITO EFETUADO COM SUCESSO" AT 2005
           ELSE
              IF WS-FD-CLIENTES-STATUS EQUALS "22"
                 DISPLAY "REGISTRO JA EXISTENTE"
              ELSE
                 DISPLAY "ERRO DESCONHECIDO" WS-FD-CLIENTES-STATUS
              END-IF
           END-IF.

           DISPLAY "DESEJA CONTINUAR? [S/N] " AT 2305.
           ACCEPT WS-OPCAO AT 2330 WITH PROMPT.

       003-FIM.
           CLOSE FD-CLIENTES.
           DISPLAY "RETORNANDO AO MENU PRINCIPAL..." AT 0805.
           STOP " ".
           GOBACK.